<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器自定义遍历对象</title>
</head>
<body>
    <script>
        let stu ={
            name: "Alice",
            score:[
                {"English": 100, "Math": 120},
                {"English": 78, "Math": 95},
                {"English": 132, "Math": 94},
                {"English": 145, "Math": 82},
            ],
            [Symbol.iterator]: function () { 
                let index = 0;
                return {
                    next:()=>{
                       const res ={'value':stu.score[i].English,'done':false}
                       if(index>= stu.score.length){
                           res.done = true;
                       }

                       return res;

                    }
                }
             }
        }

        for (const iterator of stu) {
            console.log(iterator);
            
        }
    </script>
</body>
</html>